package com.example.mapper;

import com.example.entity.Emp;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface EmpMapper {
    /**
     * 员工信息查询
     */
    List<Emp> list(String name, String position, Integer rights);

    /**
     * 批量删除
     */
    void delete(List<Integer> ids);

    /**
     * 新增员工
     */
    @Insert("insert into mall_backend.emp(name, phone, position, rights, flag, create_time, update_time) " +
            "values (#{name},#{phone},#{positon},#{rights},#{flag},#{createTime},#{updateTime})")
    void insert(Emp emp);

    /**
     * 根据ID查询员工
     */
    @Select("select * from mall_backend.emp where id = #{id}")
    Emp getById(Integer id);

    /**
     * 更新员工信息
     */
    void update(Emp emp);
}
